package jframe.action;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.beans.factory.annotation.Autowired;

import jframe.base.action.BaseAction;
import jframe.common.PageModel;
import jframe.service.DepartmentService;

/**
 * @描述:<p>部门，组织机构 Action</p>
 *
 * @作者: 叶平平(yepp)
 *
 * @时间: 2012-2-25 上午12:34:12
 */
@SuppressWarnings("serial")
public class DepartmentAction extends BaseAction {

	@Autowired
	@Resource(name="departmentService")
	private DepartmentService departmentService;
	
	/**
	 * @描述:<p>查询部门，组织机构树</p>
	 *
	 * @作者:  叶平平(yepp)
	 *
	 * @时间:  2012-2-25 下午02:57:18
	 *
	 * @修改历史: <p>修改时间、修改人、修改原因/说明</p>
	 *
	 * @return
	 */
	@SuppressWarnings({ "static-access", "unchecked" })
	public String queryDepartmentTree(){
		String departNo = this.getRequest().getParameter("node");
		List list = this.departmentService.queryDepartmentByParentNo(departNo);
		outJsonString(this.jsonHelper.getJsonArray(list));
		return null;
	}
	
	/**
	 * @描述:<p>查询部门，组织机构列表  </p>
	 *
	 * @作者:  叶平平(yepp)
	 *
	 * @时间:  2012-2-25 下午03:11:05
	 *
	 * @修改历史: <p>修改时间、修改人、修改原因/说明</p>
	 *
	 * @return
	 */
	@SuppressWarnings({ "unchecked", "static-access" })
	public String queryDepartment(){
		String departNo = "0";
		PageModel page = this.departmentService.queryDepartment(departNo);
		outJsonString(this.jsonHelper.getJsonFromList(page.getTotalRows(), page.getResult()));
		return null;
	}
}
